package com.longchat.service.impl.system;

import org.springframework.stereotype.Service;

import com.longchat.service.inter.system.IMenuService;

@Service
public class MenuService implements IMenuService {

	/*ResourceJpaRepository resourceJpaRepository;
	@Override
	public DatatablesPageViewInfo<Resource> queryMenus(BaseDataTableQueryInfo info) {
		PageRequest request = new PageRequest(info.getStart(), info.getLength());
		Page<Resource> pageResult = resourceJpaRepository.findAll(request);
		DatatablesPageViewInfo<Resource> tableInfos = new DatatablesPageViewInfo<>(pageResult.getContent(), pageResult.getSize(),  pageResult.getSize());
		return tableInfos;
	}

	@Override
	public ResultInfo addMenu(MenuMaintainInfo info) {
		Resource domain = new Resource();
		domain.setCode(info.getCode());
		domain.setDescription(info.getDetail());
		domain.setName(info.getName());
		if(info.getType()==ResourceType.MENU.getResourceType()){
			domain.setType(ResourceType.MENU);
		}else{
			domain.setType(ResourceType.BUTTON);
		}
		domain.setUrl(info.getUrl());
		domain.setSeq(info.getSeq());
		Resource parent = resourceJpaRepository.findOne(info.getPid());
		domain.setParent(parent);
		return new ResultInfo().OK();
	}

	@Override
	public ResultInfo updateMenu(MenuMaintainInfo info) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ResultInfo deleteMenu(int menuId) {
		resourceJpaRepository.delete(menuId);
		return new ResultInfo().OK();
	}

	@Override
	public List<TypeInfo> queryMenus() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public MenuInfo queryMenu(int id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<NavibarInfo> queryNavibar(String userName, boolean isCustomer) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<TypeInfo> queryAllMenusUrl(String userName) {
		// TODO Auto-generated method stub
		return null;
	}*/

}
